package com.xth8013.as.util;

import java.util.Collection;
import java.util.Map;

/**
 * 
 * @Description:
 * @author: tianhua.xie
 * @Date: 2017年2月9日 下午8:28:14
 * 
 */
public class ObjectUtils {

	
	public static boolean isBlank(Object obj)
    {
        if(obj == null)
            return true;
        if(obj instanceof CharSequence)
            return ((CharSequence)obj).length() == 0;
        if(obj instanceof Collection)
            return ((Collection)obj).isEmpty();
        if(obj instanceof Map)
            return ((Map)obj).isEmpty();
        if(obj instanceof Object[])
        {
            Object object[] = (Object[])(Object[])obj;
            if(object.length == 0)
                return true;
            boolean empty = true;
            int i = 0;
            do
            {
                if(i >= object.length)
                    break;
                if(!isBlank(object[i]))
                {
                    empty = false;
                    break;
                }
                i++;
            } while(true);
            return empty;
        } else
        {
            return false;
        }
    }

    public static boolean isNotBlank(Object obj)
    {
        return !isBlank(obj);
    }

}
